package com.kyivmohyla.kma2.client.view.engineer;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.*;
import com.google.gwt.user.datepicker.client.DateBox;
import com.kyivmohyla.kma2.client.presenter.engineer.EngineerEditOrderPresenter;
import com.kyivmohyla.kma2.client.view.common.EquipmentCellTableWidget;
import com.kyivmohyla.kma2.client.view.common.OrderHistoryWidget;
import com.kyivmohyla.kma2.client.view.common.ServiceCellTableWidget;

public class EngineerEditOrderWindowView extends Composite implements EngineerEditOrderPresenter.Display {
    private static EngineerEditOrderWindowViewUiBinder ourUiBinder = GWT.create(EngineerEditOrderWindowViewUiBinder.class);
    @UiField
    protected Label greeting;
    //    @UiField
//    protected Button saveOrder;
//    @UiField
//    protected Button saveAndClose;
    @UiField
    protected Button cancel;
    @UiField
    protected Button closeOrder;
    @UiField
    protected Button rejectToManager;
    @UiField
    protected TextBox state;
    @UiField
    protected TextBox customerName;
    @UiField
    protected TextBox customerPhone;
    @UiField
    protected TextArea customerAddress;
    @UiField
    protected TextBox customerEmail;
    @UiField
    protected DateBox plannedStart;
    @UiField
    protected DateBox plannedEnd;
    @UiField
    protected TextArea commentary;
    @UiField
    protected TextBox myCommentary;
    @UiField
    protected ServiceCellTableWidget serviceCellTable;
    @UiField
    protected EquipmentCellTableWidget equipmentCellTable;
    @UiField
    protected OrderHistoryWidget orderHistoryCellTable;

    public EngineerEditOrderWindowView() {
        initWidget(ourUiBinder.createAndBindUi(this));
        greeting.setText("This is Order Editing And Assigning Window");
        plannedStart.setFormat(new DateBox.DefaultFormat(DateTimeFormat.getFormat("dd.MM.yyyy HH:mm:ss")));
        plannedEnd.setFormat(new DateBox.DefaultFormat(DateTimeFormat.getFormat("dd.MM.yyyy HH:mm:ss")));
    }

    @Override
    public HasText getState() {
        return state;
    }

    @Override
    public HasText getCustomerName() {
        return customerName;
    }

    @Override
    public HasText getCustomerPhone() {
        return customerPhone;
    }

    @Override
    public HasText getCustomerAddress() {
        return customerAddress;
    }

    @Override
    public HasText getCustomerEmail() {
        return customerEmail;
    }

    @Override
    public HasText getPlannedStart() {
        return plannedStart.getTextBox();
    }

    @Override
    public HasText getPlannedEnd() {
        return plannedEnd.getTextBox();
    }

    @Override
    public HasText getCommentary() {
        return commentary;
    }

    @Override
    public HasText getMyCommentary() {
        return myCommentary;
    }
//
//    @Override
//    public HasClickHandlers getSaveOrderButton() {
//        return saveOrder;
//    }
//
//    @Override
//    public HasClickHandlers getSaveAndCloseButton() {
//        return saveAndClose;
//    }

    @Override
    public HasClickHandlers getCancelButton() {
        return cancel;
    }

    @Override
    public HasClickHandlers getCloseOrderButton() {
        return closeOrder;
    }

    @Override
    public ServiceCellTableWidget getServiceCellTable() {
        return serviceCellTable;
    }

    @Override
    public EquipmentCellTableWidget getEquipmentCellTable() {
        return equipmentCellTable;
    }

    @Override
    public OrderHistoryWidget getOrderHistoryCellTable() {
        return orderHistoryCellTable;
    }

    @Override
    public HasClickHandlers getRejectToManagerButton() {
        return rejectToManager;
    }

    @Override
    public Widget asWidget() {
        return this;
    }

    interface EngineerEditOrderWindowViewUiBinder extends UiBinder<Widget, EngineerEditOrderWindowView> {
    }
}